package com.Test;
import com.entity.Member;
import com.service.MemberService;
import com.service.impl.MemberServiceImpl;
import com.util.DBUtil;
import org.junit.Test;
import java.sql.PreparedStatement;
import java.time.Instant;
import java.util.Date;
import java.util.List;
public class TestMemberServiceImpl {
    private MemberService memberService=new MemberServiceImpl();
    @Test
    public void testUpdate(){
        Member member=new Member(6,"王五","女", Date.from(Instant.now()),"198",1,Date.from(Instant.now()));
        memberService.update(member);
    }
    @Test
    public void testSelectByName() {
        List<Member> list= memberService.selectByName("王五").getList();
        list.forEach(System.out::println);
    }
    @Test
    public void testdelete(){
        String sql = "delete from member where num=1";
        PreparedStatement preparedStatement= DBUtil.createPreparedStatement(sql);
        DBUtil.execUpdate(preparedStatement);
    }
}
